<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>正则复习</title>
</head>
<body>
    

    <script>
    
        // 正则的复习

        var reg = /\d+/g;
        
        console.log(reg.exec('123abcd789'));
        console.log(reg.exec('123abcd789'));


        {
            // 获取 ?wd=js&rsv=1&qid=test&issp=0&f=8&bp=1001
            let str = '?wd=js&rsv=1&qid=test&issp=0&f=8&bp=1001';
            let reg = /([^?&]+)=([^?&]+)/g;
            let obj = {};
            str.replace(reg,function () {
                obj[arguments[1]] = arguments[2];
            });
            console.log(obj);
        }
    
    </script>

</body>
</html>